package com.blkj.modular.admin.controller;

import com.blkj.common.core.bean.R;
import com.blkj.common.core.entity.ArticleEntity;
import com.blkj.modular.article.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 北浪 2021/11/30
 */
@Controller
@RequestMapping("/admin/article")
public class ArticleController {

    @Autowired
    ArticleService articleService;

    @RequestMapping({"","/list"})
    public String articleList(){
        return "";
    }

    @RequestMapping("/edit")
    public String articleEdit(){
        return "/admin/articleEdit";
    }

    @RequestMapping(value = "/save",method = RequestMethod.POST)
    @ResponseBody
    public R articleSave(@RequestBody ArticleEntity article){
        articleService.save(article);
        return R.ok();
    }
}
